package com.apes.enquiry.product.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.scm.masterdata.party.model.PartyRole;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 类描述：替换件关系
 *
 * @ClassName ReplacePiece
 * @Description 描述：替换件关系对照表
 * @Author wushilong
 * @Date 2022/10/13 14:10
 * @Version 1.0
 */

@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = ReplacePiece.CONST_TABLE_NAME)
public class ReplacePiece extends Model {

    public static final String CONST_TABLE_NAME = "msa_replace_piece";

    @Id
    @Column(name = "id", length = 6)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "替换件关系")
    @Comment("商品编码")
    private String id; //商品编码

    @Column(name = "replace_piece_group", nullable = false, length = 24)
    @Comment("替换件组号")
    private String replacePieceGroup;

    @Column(name = "auto_brand", nullable = false, length = 24)
    @Comment("车品牌")
    private String autoBrand;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "supplier_id", referencedColumnName = "id")
    @Comment("供应商")
    private PartyRole supplier;

    @Column(name = "oe_mark", nullable = false, length = 24)
    @Comment("oe号")
    private String oeMark;//原厂件号

}
